package com.atguigu.gulimallflow.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.atguigu.gulimallflow.entity.ActRuDeadletterJobEntity;
import com.atguigu.gulimallflow.service.ActRuDeadletterJobService;
import utils.PageUtils;
import utils.R;


/**
 *
 *
 * @author humingyang
 * @email humingyang@163.com
 * @date 2022-04-10 15:02:52
 */
@RestController
@RequestMapping("gulimallflow/actrudeadletterjob")
public class ActRuDeadletterJobController {
    @Autowired
    private ActRuDeadletterJobService actRuDeadletterJobService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("gulimallflow:actrudeadletterjob:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = actRuDeadletterJobService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("gulimallflow:actrudeadletterjob:info")
    public R info(@PathVariable("id") String id){
		ActRuDeadletterJobEntity actRuDeadletterJob = actRuDeadletterJobService.getById(id);

        return R.ok().put("actRuDeadletterJob", actRuDeadletterJob);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("gulimallflow:actrudeadletterjob:save")
    public R save(@RequestBody ActRuDeadletterJobEntity actRuDeadletterJob){
		actRuDeadletterJobService.save(actRuDeadletterJob);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("gulimallflow:actrudeadletterjob:update")
    public R update(@RequestBody ActRuDeadletterJobEntity actRuDeadletterJob){
		actRuDeadletterJobService.updateById(actRuDeadletterJob);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
   // @RequiresPermissions("gulimallflow:actrudeadletterjob:delete")
    public R delete(@RequestBody String[] ids){
		actRuDeadletterJobService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
